package com.example.nutrition;


import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MySQLiteHelper extends SQLiteOpenHelper {

	private static final String DATABASE_NAME = "LebensmittelDB.db";
	private static final int DATABASE_VERSION = 1;

	private static final String TABLE_CREATE_LEBENSMITTEL = ""
			+ "create table Lebensmittel("
			+ " ID integer primary key autoincrement," + "Name text, "
			+ "kcal int," + "Magnesium double,"+" Calcium double,"+"Eisen double,"+"Zink double)";

	;

	public MySQLiteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase database) {
		database.execSQL(TABLE_CREATE_LEBENSMITTEL);
	}

	@Override
	public void onUpgrade(SQLiteDatabase database, int oldVersion,
			int newVersion) {
		Log.w(MySQLiteHelper.class.getName(),
				"Upgrading database from version " + oldVersion + " to "
						+ newVersion + ", which will destroy all old data");
		database.execSQL("DROP TABLE IF EXISTS SCANITEM");
		onCreate(database);
	}

}
